package com.wetsion.securityoauthdemo.sdkdemo.config;

import com.dxy.data.rms.sdk.filter.RmsOauthFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author weixin
 * @version 1.0
 * @CLassName BeanConfig
 * @date 2019/3/13 5:21 PM
 */
@Configuration
public class BeanConfig {

    @Bean
    public RmsOauthFilter rmsOauthFilter() {
        return new RmsOauthFilter();
    }

    @Bean
    public FilterRegistrationBean filterRegistrationBean(RmsOauthFilter rmsOauthFilter) {
        FilterRegistrationBean<RmsOauthFilter> filterFilterRegistrationBean
                = new FilterRegistrationBean<>();
        filterFilterRegistrationBean.setFilter(rmsOauthFilter);
        filterFilterRegistrationBean.addUrlPatterns("/api/*");
        return filterFilterRegistrationBean;
    }
}
